package Train;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;

public class oneDay {
    //排序子序列
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            long[] array = new long[n];
            //获取输入
            for (int i = 0; i < n; i++) {
                array[i] = scanner.nextLong();
            }
            //用来计数
            //只要数组有元素,count最小为1
            int count = 1;
            for (int i = 1; i < array.length-1; i++) {
                if(( array[i] > array[i-1] && array[i] > array[i+1]) ||(array[i-1] > array[i] && array[i] < array[i+1])) {
                    count++;
                    if(n-3 != i){
                        i++;
                    }
                }
            }
            System.out.println(count);
        }
    }

    //倒置字符串
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String str = scanner.nextLine();
            //创建两个栈
            Stack<Character> stack1 = new Stack<>();
            Stack<Character> stack2 = new Stack<>();
            for (int i = 0; i < str.length(); i++) {
                String c = str.charAt(i)+"";
                    if(c.equals(" ")){
                        //是空格嘛,是的话就全部放到queue2
                        while (!stack1.isEmpty()){
                            stack2.push(stack1.pop());
                        }
                        stack2.push(c.charAt(0));
                    }else {
                        stack1.push(c.charAt(0));
                    }
            }
            if(!stack1.isEmpty()){
                while (!stack1.isEmpty()){
                    stack2.push(stack1.pop());
                }
            }
            while (!stack2.isEmpty()){
                System.out.print(stack2.pop());
            }
            System.out.println();
        }
    }
}
